package com.bigshen.demo.annotation.configurecomponents.a2Scope;

import com.bigshen.demo.project.entity.Person;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class MyTest {

    @Test
    public void test() {

        ApplicationContext applicationContext = new AnnotationConfigApplicationContext(MyConfig.class);

        Person person = (Person) applicationContext.getBean("person");

        Person person1 = (Person) applicationContext.getBean("person");
        System.out.println(person == person1);

        Person person2 = applicationContext.getBean(Person.class);
        System.out.println(person == person2);

    }

}
